<template>
  <!-- //！！！！！！！！！ 注销的是你原来的代码,我没删除，只是注销了！！！！！！！！！ -->
  <!-- 新增按钮 -->
  <el-main>

     <!-- <el-button type="primary" class="souan">搜索</el-button>
    <el-input v-model="input" placeholder="请输入内容" class="sou"></el-input> -->
    <el-table :data="tableData">
          
      <!-- <el-table-column prop="s_id" label="#" width="140">
          </el-table-column> -->
      <el-table-column prop="s_name" label="学生姓名" >
      </el-table-column>
      <!-- <el-table-column prop="s_sex" label="性别"> </el-table-column> -->
      <el-table-column prop="subject" label="学科"> </el-table-column>
      <el-table-column prop="score" label="分数"> </el-table-column>
      <el-table-column prop="teacher_name" label="教师姓名"> </el-table-column>
      <!-- <el-table-column prop="s_number" label="学号"> </el-table-column> -->
      <!-- <el-table-column prop="password" label="密码">
          </el-table-column> -->
    </el-table>
    </el-main>

</template>

<script>
import { defineComponent } from "vue";
const axios = require("axios");

export default defineComponent({
  name: "Jsbbxx",
  components: {},
  data() {
    return {
      input: "",
      labelPosition: "top",
      tableData: [],
      dialogFormVisible: false, //增加的表单
      dialogFormVisible1: false, //修改的表单
      form: {
        subject: "",
        score: "",
        teacher_name: "",
        s_name: "",
      },
      rules: {
        s_name: [{ required: true, message: "请输入学生姓名", trigger: "blur" }],
        s_sex: [{ required: true, message: "请选择学生性别", trigger: "blur" }],
        s_phone: [{ required: true, message: "请输入学生手机号", trigger: "blur" }],
        s_idcard: [{ required: true, message: "请输入学生身份证号", trigger: "blur" }],
        s_year: [{ required: true, message: "请输入学年制", trigger: "blur" }],
        s_number:[{ required: true, message: "请输入学号", trigger: "blur" }],
        class_id: [{ required: true, message: "请输入班级id", trigger: "blur" }],
        major_id: [{ required: true, message: "请输入专业id", trigger: "blur" }],
        college_id:[{ required: true, message: "请输入二级学院id", trigger: "blur" }],
      },
    };
  },
  mounted() {
    this.form.teacher_name = this.$store.state.teacher_name;
    this.Classindividual();
  },
  methods: {
    create() {
      this.form = {
        s_name: "",
        s_sex: "",
        s_phone: "",
        s_idcard: "",
        s_year: "",
        s_number: "",
        class_id: "",
        major_id: "",
        college_id: "",
      };
      this.dialogFormVisible = true;
    },
    
    doInsert(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let _this = this;
          //  this.form.s_id = parseInt(this.form.s_id);
          this.form.s_year = parseInt(this.form.s_year);
          this.form.class_id = parseInt(this.form.class_id);
          this.form.major_id = parseInt(this.form.major_id);
          this.form.college_id = parseInt(this.form.college_id);
          axios
            .post(
              "https://localhost:44386/api/Manage/createStudents",
              this.form
            )
            .then(function (response) {
              if (response.data >= 1) {
                _this.$notify({
                  title: "成功",
                  message: "添加成功",
                  type: "success",
                });
                _this.dialogFormVisible = false;
              } else {
                _this.$notify({
                  title: "警告",
                  message: "添加异常",
                  type: "warning",
                });
              }
              _this.testGet();
            });
        } else {
          return false;
        }
      });
    },
    Classindividual() {
      let _this = this;
      axios
        .post("https://localhost:44386/api/Teachers/getClassScores", {
          teacher_name: "孙",
        })
        .then(function (response) {
          // handle success
          _this.tableData = response.data;
        });
    },
    
  },
});
</script>

<style >
.souan{
  float: right;
}
.sou{
  width: 200px;
  float: right;
}
header {
  /*header容器，一个template必须只能有一个容器*/
  display: flex; /*弹性布局*/
  height: 100%;
  align-items: center;
  justify-content: space-between; /*不用float浮动布局，采用两边布局*/
}
.l-content {
  /*左边的菜单拉伸按钮*/
  display: flex;
  align-items: center;
}
.l-content .el-button {
  /*面包屑跟 菜单按钮的间距*/
  margin-right: 20px;
}

.r-content .user {
  /*设置图片的大小，以及圆滑度*/
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.el-breadcrumb__inner a,
.el-breadcrumb__inner.is-link {
  color: #fff;
}
.tac {
  text-align: center;
}
.el-menu-vertical-demo {
  width: 200px;
}
.el-container {
  height: 738px;
}
body {
  margin: 0;
  padding: 0;
}
.el-header,
.el-footer {
  background-color: #333333;
  color: var(--el-text-color-primary);
  text-align: center;
  line-height: 60px;
}

.el-aside {
  color: var(--el-text-color-primary);
  text-align: center;
}

.el-main {
  background-color: #e9eef3;
  color: var(--el-text-color-primary);
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>